package util;

import java.util.HashMap;
import java.util.Map;

import com.lz.entity.EquipmentSheet;
import com.lz.entity.MortgageSheet;

public class BackUtil {

	public static Map<String, Object> back(EquipmentSheet sheet, String start_time, String end_time){
		Map<String, Object> map = new HashMap<>();
		if(sheet.getEquipmentSheetNo() != null) {
			map.put("equipmentSheetNo", sheet.getEquipmentSheetNo());
		}
		if(sheet.getCustomer() != null && !"".equals(sheet.getCustomer().getCustomerName())) {
			map.put("customerName", sheet.getCustomer().getCustomerName());
		}
		if(sheet.getCar() != null && !"".equals(sheet.getCar().getVin())) {
			map.put("vin", sheet.getCar().getVin());
		}
		if(sheet.getCar() != null && !"".equals(sheet.getCar().getCarCard())) {
			map.put("carCard", sheet.getCar().getCarCard());
		}
		if(sheet.getUpholsteryType() != null && !"-1".equals(sheet.getUpholsteryType().getUpholsteryType()) ) {
			map.put("upholsteryType", sheet.getUpholsteryType().getUpholsteryType());
		}
		if(start_time != null && !"".equals(start_time)) {
			map.put("start_time", start_time);
		}
		if(end_time != null && !"".equals(end_time)) {
			map.put("end_time", end_time);
		}
		
		return map;
		
	}
	
	public static Map<String, Object> mortgageBack(MortgageSheet mortgageSheet,String start_time,String end_time){
		Map<String, Object> map = new HashMap<>();
		
		if(mortgageSheet.getMortgageSheetNo() != null) {
			map.put("mortgageSheetNo", mortgageSheet.getMortgageSheetNo());
		}
		if(mortgageSheet.getCar() != null && mortgageSheet.getCar().getVin() != null && !"".equals(mortgageSheet.getCar().getVin()) ) {
			map.put("vin", mortgageSheet.getCar().getVin());
		}
		if(mortgageSheet.getCustomer() != null && mortgageSheet.getCustomer().getCustomerId() != null) {
			map.put("customerId", mortgageSheet.getCustomer().getCustomerId());
		}
		if(mortgageSheet.getCustomer() != null && mortgageSheet.getCustomer().getCustomerName() != null && !"".equals(mortgageSheet.getCustomer().getCustomerName())) {
			map.put("customerName", mortgageSheet.getCustomer().getCustomerName());
		}
		if(mortgageSheet.getOrderId() != null) {
			map.put("orderId", mortgageSheet.getOrderId());
		}
		if(mortgageSheet.getBank()!=null && mortgageSheet.getBank().getBankName() !=null && !"-1".equals(mortgageSheet.getBank().getBankName())) {
			map.put("bankName", mortgageSheet.getBank().getBankName());
		}
		if(mortgageSheet.getEmployee() != null && mortgageSheet.getEmployee().getEmployeeName() != null && !"-1".equals(mortgageSheet.getEmployee().getEmployeeName())) {
			map.put("employeeName", mortgageSheet.getEmployee().getEmployeeName());
		}
		if(mortgageSheet.getMortgageSheetState() != null && !"".equals(mortgageSheet.getMortgageSheetState())) {
			map.put("mortgageSheetState", mortgageSheet.getMortgageSheetState());
		}
		if((start_time != null && !"".equals(start_time))) {
			map.put("start_time", start_time);
		}
		if(end_time != null && !"".equals(end_time)) {
			map.put("end_time", end_time);
		}
		
		return map;
		
	}
}
